/**
 * Created by wubin on 2016-04-17.
 */
export class Utils {
    static invalidSign():Array<string> {
        return [" ", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")",
            "<", ">", "?"];
    }

    /**
     * Chinese words are two byte size, and English words are one byte size,
     * this method can return the real size of target string that mixes with 
     * Chinese and English.
     * @param str the mixed target string with Chinese and English words.
     * @returns {number}
     */
    static getRealByteSize(str:string):number {
        var char = str.replace(/[^\x00-\xff]/g, '**');
        return char.length;
    }

    /**
     * set string's initial to uppercase letter.
     * @param target target string that should be set.
     * @returns {string} the result that is set.
     */
    static setInitialUpperCase(target:string):string{
        return target.substring(0, 1).toUpperCase().concat(target.slice(1));
    }
}